import Vue from 'vue'
import Router from 'vue-router'
import home from '@/components/home/home'
import user from '@/components/user/user'
import taxi from '@/components/taxi/taxi'
import callTaxi from "@/components/taxi/callTaxi";
import replace from '@/components/replace/replace'
import bus from '@/components/bus/bus'
import travel from '@/components/user/menuPages/travel'
import setting from '@/components/user/menuPages/setting'
import wallet from '@/components/user/menuPages/wallet'
import login from '@/components/user/loginRegisterPages/login'
import register from '@/components/user/loginRegisterPages/register'
import order from '@/components/order/index'
import accepte from '@/components/order/accepte'
import loader from '@/components/order/loader'
import suggest from '@/components/suggest/suggest'
import webError from '@/components/webError'
import developing from '@/components/developing'
import driverHome from '@/components/driver/driverHome'
import goPassenger from "@/components/driver/goPassenger";
import passengerStart from "@/components/order/passengerStart";
import driverStart from "@/components/driver/driverStart";
import empty from "@/components/empty";
import orderEnd from "@/components/order/orderEnd";
import orderScueess from "@/components/driver/orderScueess";
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/home/taxi',
      name: 'home',
      component: home,
      alias:'/' || '/home',
      meta: {
        requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      },
      children: [
        {
          path: 'home/taxi',
          name: 'taxi',
          component: taxi
        },
        {
          path: 'home/replace',
          name: 'repalce',
          component: replace
        },
        {
          path: 'home/bus',
          name: 'bus',
          component: bus
        },
      ]
    },
    {
      path: '/driver/home',
      name: 'driver',
      component: driverHome,
      meta: {
        requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      }
    },
    {
      path: '/driver/goPassenger',
      name: 'goPassenger',
      component: goPassenger
    },
    {
      path: '/home/taxi/call',
      name: 'callTaxi',
      component: callTaxi
    },
    {
      path: '/passenger/startJourney',
      name: 'passengerStart',
      component: passengerStart
    },
    {
      path: '/driver/startJourney',
      name: 'driverStart',
      component: driverStart
    },
    {
      path: '/passenger/order/end',
      name: 'orderEnd',
      component: orderEnd
    },
    {
      path: '/driver/order/end',
      name: 'orderScueess',
      component: orderScueess
    },
    {
      path: '/empty',
      name:'empty',
      component: empty
    },
    {
      path:'/suggest',
      name: 'suggest',
      component: suggest,
      meta: {
        requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      },
    },
    {
      path:'/user',
      name:'user',
      component: user,
      meta: {
        requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      },
      children: [
        {
          path: '/user/travel',
          name: 'travel',
          component: travel
        },
        {
          path: '/user/setting',
          name: 'setting',
          component: setting
        },
        {
          path: '/user/wallet',
          name: 'wallet',
          component: wallet
        }
      ]
    },
    {
      path: '/user/login',
      name: 'login',
      component: login
    },
    {
      path: '/user/register',
      name: 'register',
      component: register
    },
    {
      path:'/order',
      name:'order',
      component: order,
      meta: {
        requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      },
      children: [
        {
          path: '/order/loader',
          name:'loader',
          component: loader
        },
        {
          path: '/order/accepte',
          name:'accepte',
          component: accepte
        }
      ]
    },
    {
      path: '/webError',
      component: webError
    },
    {
      path: '/developing',
      component: developing
    }
  ]
})
